<?php 
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
try{
$mngonngu=array("tongxetrongthang"=>"금월통과차량 ","tongxetrongngay"=>"금일통과차량");
include '../connection/connection_loadxe.php';
	if($connectionxe){
		set_time_limit(0);
		$now=getdate();
		$d=$now[mday];
		$y=$now[year];
		$m=$now[mon];
		$countM=0;
		$countD=0;
		$sql="SELECT (select count(*) as countM from carnum where car_datetime >= '$y-$m-01 00:00:00' and car_datetime < '$y-$m-$d 23:59:59') as countM, 
(select count(*) as countD from carnum where car_datetime >= '$y-$m-$d 00:00:00' and car_datetime < '$y-$m-$d 23:59:59') as countD";
	$result=mysql_query($sql,$connectionxe);
		while ($row=mysql_fetch_array($result)){
			$countM=$row['countM'];
			$countD=$row['countD'];
		}
		?>
		<p style="padding-left:50px;"><?=$mngonngu['tongxetrongthang']?> : <?=number_format($countM)?></p>
		<p style="padding-left:50px;"><?=$mngonngu['tongxetrongngay']?> : <?=number_format($countD)?></p>
		<?php 
			mysql_close($connectionxe);
	}else{
		echo "die";	
	}
}catch(Exception $e){
	echo $e->getMessage();
}
?>
